package com.dut.bbs.data;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import android.util.Log;

import com.dut.bbs.util.URLConstant;
import com.dut.bbs.web.HtmlSource;

public class UserInfo {
	/**
	 * 
	 * @param ID 查询的用户ID
	 * @return 用户个人信息，分行列出
	 */
	public static String getInfo(String ID){
		String info = "";
		try {
			String html = HtmlSource.getHtml_data(URLConstant.USER_QUERY+ID);
			Log.v("UserInfo", html);
			Document doc = null;
			doc = Jsoup.parse(html); 
			Elements eles = doc.getElementsByClass("list");
			for(Element e:eles.get(0).children()){
				info += (e.text()+"\n");					
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			info = "抱歉，查询用户信息失败，请稍后重试。";
			Log.v("USERINFO", e.toString());
		}
		return info;		
	}
}
